mock instead of stub the open call

Chris Eidhof 9 years ago
parent
commit
9cb0670922
2 changed files with 2 additions and 1 deletions
  1. 1 0
      app/models/agents/pdf_info_agent.rb
  2. 1 1
      spec/models/agents/pdf_agent_spec.rb

+ 1 - 0
app/models/agents/pdf_info_agent.rb

@@ -58,5 +58,6 @@ module Agents
58 58
         create_event :payload => info.merge(payload)
59 59
       end
60 60
     end
61
+
61 62
   end
62 63
 end

+ 1 - 1
spec/models/agents/pdf_agent_spec.rb

@@ -21,7 +21,7 @@ describe Agents::PdfInfoAgent do
21 21
 
22 22
     it "should call HyPDF" do
23 23
       expect {
24
-        stub(agent).open { "data" }
24
+        mock(agent).open('http://mypdf.com') { "data" }
25 25
         mock(HyPDF).pdfinfo('data') { {title: "Huginn"} }
26 26
         agent.receive([@event])
27 27
       }.to change { Event.count }.by(1)